04. Make A Label

Make A Label

Question:

Start Quiz:

<!DOCTYPE html>

<!--
For the first input, add a label by using the `for` attribute.
For the second input, add a label by nesting. Note that BOTH labels
need `for` attributes to ensure screen reader support.
-->

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Quiz - Labels</title>
</head>
<body>
    <form>
        <span>Same as billing address</span>
        <input type="checkbox">

        <br>

        <span>Telephone Number</span>
        <input type="tel">
    </form>
</body>
</html>
Solution:

INSTRUCTOR NOTE:

Labels on MDN

Follow us online!

@cwpittman

@greenido

+greenido
Cameron says: In this quiz, you're going to use two methods to attach an input to a label. Whether or not to wrap an input in a label is a matter of personal preference. However, not all browsers treat inputs wrapped with labels the same way, which is why we want you to practice with the for attribute for the first part of the question.